package com.qfedu.gytv.dao;

import com.qfedu.gytv.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * @description: 码起 自动生成代码
 * @author: my
 * @create: 2020-09-16 20:01:16
 */
public interface UserDao {
    @Insert("insert into tb_user (name,sex,phone,password,birthday,aid) values(#{name},#{sex},#{phone},#{password},#{birthday},#{aid})")
    int insert(User user);

    @Delete("delete from tb_user where id = #{id}")
    int deleteById(int id);

    @Select("select * from tb_user")
    List<User> all();

    /**
     * 通过phone查询用户信息
     * @param phone 需要查询的phone
     * @return 查询到的用户信息
     */
    @Select("select * from tb_user where phone = #{phone}")
    User selectByPhone(String phone);
}
